home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_kernel_source / SCRIPTS / TKPARSE.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  105 lines

  1. /*
  2.  * tkparse.h
  3.  */
  4.  
  5. /*
  6.  * Token types (mostly statement types).
  7.  */
  8.  
  9. enum e_token
  10. {
  11.     token_UNKNOWN,
  12.     token_bool, 
  13.     token_choice_header,
  14.     token_choice_item,
  15.     token_comment, 
  16.     token_define_bool,
  17.     token_dep_tristate,
  18.     token_else, 
  19.     token_endmenu,
  20.     token_fi, 
  21.     token_hex,
  22.     token_if, 
  23.     token_int,
  24.     token_mainmenu_name, 
  25.     token_mainmenu_option, 
  26.     token_source,
  27.     token_string,
  28.     token_then,
  29.     token_tristate, 
  30.     token_unset,
  31. };
  32.  
  33. /*
  34.  * Operator types for conditionals.
  35.  */
  36.  
  37. enum operator
  38. {
  39.     op_eq,
  40.     op_neq,
  41.     op_and,
  42.     op_and1,
  43.     op_or,
  44.     op_bang,
  45.     op_lparen,
  46.     op_rparen,
  47.     op_constant,
  48.     op_variable,
  49.     op_kvariable,
  50.     op_nuked
  51. };
  52.  
  53. /*
  54.  * Conditions come in linked lists.
  55.  * Some operators take strings:
  56.  *
  57.  *   op_constant   "foo"
  58.  *   op_variable   "$ARCH", "$CONFIG_PMAC"
  59.  *   op_kvariable  "$CONFIG_EXPERIMENTAL"
  60.  *
  61.  * Most "$..." constructs refer to a variable which is defined somewhere
  62.  * in the script, so they become op_kvariable's instead.  Note that it
  63.  * is legal to test variables which are never defined, such as variables
  64.  * that are meaningful only on other architectures.
  65.  */
  66.  
  67. struct condition
  68. {
  69.     struct condition * next;
  70.     enum operator op;
  71.     const char * str;        /* op_constant, op_variable */
  72.     struct kconfig * cfg;    /* op_kvariable */
  73. };
  74.  
  75. /*
  76.  * A statement from a config.in file
  77.  */
  78.  
  79. struct kconfig
  80. {
  81.     struct kconfig *    next;
  82.     enum e_token    token;
  83.     char *        optionname;
  84.     char *        label;
  85.     char *        value;
  86.     struct condition *    cond;
  87.     char *        depend;        /* token_dep_tristate */
  88.     struct kconfig *    cfg_parent;    /* token_choice_item */
  89.  
  90.     /* used only in tkgen.c */
  91.     char        global_written;
  92.     int            menu_number;
  93.     int            menu_line;
  94.     struct kconfig *    menu_next;
  95. };
  96.  
  97.  
  98.  
  99. /*
  100.  * Prototypes
  101.  */
  102.  
  103. extern void fix_conditionals ( struct kconfig * scfg );        /* tkcond.c */
  104. extern void dump_tk_script   ( struct kconfig * scfg );        /* tkgen.c  */
  105.